package com.zork.cmdb.webapi.mapper.cmdb;

import com.zork.cmdb.webapi.domain.dto.UserDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author chenjh
 * @date 2018/5/9
 * @description
 */
@Mapper
public interface UserMapper {

    @Select("SELECT [UserID]\n" +
            "      ,[UserName]\n" +
            "      ,[TrueName]\n" +
            "      ,[Password]\n" +
            "      ,[Telphone]\n" +
            "      ,[Email]\n" +
            "      ,[Mobile]\n" +
            "      ,[Sex]\n" +
            "      ,[Address]\n" +
            "      ,[ImagePath]\n" +
            "      ,[State]\n" +
            "      ,[UserType]\n" +
            "      ,[MainOrgID]\n" +
            "      ,[Comment]\n" +
            "      ,[CreateTime] FROM [User] ORDER BY [UserID]")
    List<UserDTO> listUser();

    @Select("SELECT [UserID]\n" +
            "      ,[UserName]\n" +
            "      ,[TrueName]\n" +
            "      ,[Password]\n" +
            "      ,[Telphone]\n" +
            "      ,[Email]\n" +
            "      ,[Mobile]\n" +
            "      ,[Sex]\n" +
            "      ,[Address]\n" +
            "      ,[ImagePath]\n" +
            "      ,[State]\n" +
            "      ,[UserType]\n" +
            "      ,[MainOrgID]\n" +
            "      ,[Comment]\n" +
            "      ,[CreateTime] FROM [User] WHERE [UserID] = #{id}")
    UserDTO getUser(@Param("id") Long id);
}
